package com.axxc.jpa.pattendegign.command;

import java.util.HashMap;
import java.util.Map;
/**
 * 
 * @ClassName Waiter
 * @Description //TODO 通过Invorker执行Command对象，要求命令对象执行请求，通常会持有命令对象，可以持有很多的命令对象
 * @author xxc
 * @data 2018年9月16日下午9:52:15
 * @see {@link http://gitee.com/biuabiu/  }
 */
public class WaiterInvoke {
	private Map<String, Command> commands;

	public Map<String, Command> getCommands() {
		if (commands == null) {
			commands = new HashMap<String, Command>();
		}

		return commands;
	}

	public void setCommand(String key, Command command) {
		if (commands == null) {
			commands = new HashMap<String, Command>();
		}
		commands.put(key, command);
	}

	public void RemoveCommand(String key) {
		commands.remove(key);
	}

	public void sail(String key) {
		Command command = commands.get(key);
		if (command != null) {
			command.sail();
		}
	}
}